package com.dayou.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.dayou.bean.BringRecord;
import com.dayou.service.IBringRecordService;
import com.dayou.common.core.controller.BaseController;
import com.dayou.common.core.page.TableDataInfo;
import com.dayou.common.core.domain.AjaxResult;
import com.dayou.common.utils.poi.ExcelUtil;
import org.springframework.web.bind.annotation.RestController;

/**
 * 提审会见值班室民警带人记录 信息操作处理
 * 
 * @author dayou
 * @date 2020-05-11
 */
@RestController
@RequestMapping("/bringRecord")
public class BringRecordController extends BaseController
{
	@Autowired
	private IBringRecordService bringRecordService;
								
    /**
	 * 查询所有提审会见值班室民警带人记录列表
	 */
	@PostMapping("/listAll")
	@ResponseBody
	public TableDataInfo listAll(@RequestBody BringRecord bringRecord)
	{
		startPage();
        List<BringRecord> list = bringRecordService.selectBringRecordList(bringRecord);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出提审会见值班室民警带人记录列表
	 */
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(@RequestBody BringRecord bringRecord)
    {
    	List<BringRecord> list = bringRecordService.selectBringRecordList(bringRecord);
        ExcelUtil<BringRecord> util = new ExcelUtil<BringRecord>(BringRecord.class);
        return util.exportExcel(list, "bringRecord");
    }
	
	/**
	 * 新增保存提审会见值班室民警带人记录
	 */
	@PostMapping("/add")
	@ResponseBody
	public AjaxResult addSave(@RequestBody BringRecord bringRecord)
	{		
		return toAjax(bringRecordService.insertBringRecord(bringRecord));
	}

	/**
	 * 修改保存提审会见值班室民警带人记录
	 */
	@PostMapping("/edit")
	@ResponseBody
	public AjaxResult editSave(@RequestBody BringRecord bringRecord)
	{		
		return toAjax(bringRecordService.updateBringRecord(bringRecord));
	}
	
	/**
	 * 删除提审会见值班室民警带人记录
	 */
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(@RequestParam String ids)
	{		
		return toAjax(bringRecordService.deleteBringRecordByIds(ids));
	}
	
}
